<?php
    if(class_exists('ReadFile') === false)
    {
		/*
		Classe para Leitura de Arquivo TXT
		*/
        Class ReadFile
        {

            private $_file = "";
            private $_itemNames = array();
            private $_itemPosX = array();
            private $_itemPosY = array();
            private $_itemClass = array();
            private $_section = -1;
            private $_line = "";
            private $_id = -1;
            private $_word = "";
            private $_column = 0;
            private $_string = false;
            private $_name = "";
			
			/**
				Function para leitura do arquivo txt.
			*/
            public function load()
            {
                /*LEITOR DE ITEM.TXT. 
                CREDITOS WOLF.*/

                $key = 'class/DataFile/item(kor).txt';
                $this->_file = fopen($key, "r+");
                if (!$this->_file)
                {
                    die("Falha ao abrir o item(kor).txt");
                } 

                if($this->_file)
                {
                    $this->_section = -1;
                    while (!feof($this->_file)) 
                    {

                        $this->_line = fgets($this->_file);
                        $this->_line = trim($this->_line, " \t\r\n");

                        if (substr($this->_line, 0, 2) == "//" || substr($this->_line, 0, 2) == "#" || $this->_line == "") 
                        {
                            continue;
                        }

                        if (($pos = strpos($this->_line, "//")) !== false) 
                        {
                            $this->_line = substr($this->_line, 0, $pos);
                        }
                        $this->_line = trim($this->_line, " \t\r\n");

                        if ($this->_section == -1) 
                        {
                            if (is_numeric($this->_line)) 
                            {
                                $this->_section = (int)$this->_line;
                            }
                        } 
                        else 
                        {
                            if (strtolower($this->_line) == "end") 
                            {
                                $this->_section = -1;
                                continue;
                            }
                            else 
                            {
                                $this->_word = "";
                                $this->_column = 0;
                                $this->_string = false;
                                $this->_id = -1;
                                $this->_name = "&lt;??????????????&gt;";
                                $tam = strlen($this->_line);

                                for ($i = 0; $i < $tam; $i++)
                                {
                                    if ($this->_string == true) 
                                    {
                                        if ($this->_line{$i} == "\"") 
                                        {
                                            $this->_string = false;
                                        }
                                        else 
                                        {
                                            $this->_word .= $this->_line{$i};
                                        }
                                    } 
                                    else 
                                    {
                                        if ($this->_word == "") 
                                        {
                                            if ($this->_line{$i} == "\"") 
                                            {
                                                $this->_string = true;
                                            }
                                            else
                                                if ($this->_line{$i} != " " && $this->_line{$i} != "\t") 
                                                {
                                                    $this->_word .= $this->_line{$i};
                                                }
                                        }
                                        else 
                                        {
                                            if ($this->_line{$i} == " " || $this->_line{$i} == "\t") 
                                            {
                                                if ($this->_column == 0) 
                                                {
                                                    $this->_id = $this->_word;
                                                } 
                                                if ($this->_column == 3) 
                                                {
                                                    $x = $this->_word;
                                                }
                                                if ($this->_column == 4) 
                                                {
                                                    $y = $this->_word;
                                                }
                                                if ($this->_column == 8) 
                                                {
                                                    $this->_name = $this->_word;

                                                }
                                                if ($this->_column == 23)
                                                {
                                                    $sm = $this->_word;
                                                }
                                                if ($this->_column == 24)
                                                {
                                                    $dk = $this->_word;
                                                }
                                                if ($this->_column == 25)
                                                {
                                                    $elf = $this->_word;
                                                }
                                                if ($this->_column == 26)
                                                {
                                                    $mg = $this->_word;
                                                }
                                                if ($this->_column == 27)
                                                {
                                                    $dl = $this->_word;
                                                    break; 
                                                }
                                                $this->_column++;
                                                $this->_word = "";
                                            } 
                                            else 
                                            {
                                                $this->_word .= $this->_line{$i};
                                            }
                                        }
                                    }
                                }
                                $this->_itemNames[$this->_section][$this->_id] = $this->_name; 
                                $this->_itemPosX[$this->_section][$this->_id] = $x;
                                $this->_itemPosY[$this->_section][$this->_id] = $y; 
                                $this->_itemClass[$this->_section][$this->_id]["SM"] = $sm;
                                $this->_itemClass[$this->_section][$this->_id]["BK"] = $dk;
                                $this->_itemClass[$this->_section][$this->_id]["ELF"] = $elf;
                                $this->_itemClass[$this->_section][$this->_id]["MG"] = $mg;
                                $this->_itemClass[$this->_section][$this->_id]["DL"] = $dl;
                            }
                        }
                    }
                }
            }
			
			/**
			* 	Pegar Classes que utilizam o Item
			*	@param mixed $id
			*	@param mixed $tipo
			*	@return retorna Classes que podem utilizar o Item
			*/
            protected function returnItemClass($id,$tipo)
            {
                if(sizeof($this->_itemClass) < 1)
                {
                    $this->Load();
                }
                return isset($this->_itemClass[$tipo][$id]) ? $this->_itemClass[$tipo][$id] : "";   
            }

			/**
			*	Retornar o Nome do item
			*	@param mixed $id
			*	@param mixed $tipo
			*	@return retorna Nome do Item
			*/
            protected function returnItemName($id,$tipo)
            {
                if(sizeof($this->_itemNames) < 1)
                {
                    $this->Load();
                }
                return isset($this->_ItemNames[$tipo][$id]) ? $this->_itemNames[$tipo][$id] : "Nome nao encontrado";   
            }

			/**
			*	Retornar Tamanho X
			*	@param mixed $id
			*	@param mixed $tipo
			*	@return retorna Tamanho x do Item
			*/
            protected function returnPosXItem($id,$tipo)
            {   
                if(sizeof($this->_itemPosX) < 1)
                {
                    $this->Load();
                }
                return isset($this->_itemPosX[$tipo][$id]) ? $this->_itemPosX[$tipo][$id] : "";
            }

			/**
			*	Retornar Tamanho Y
			*	@param mixed $id
			*	@param mixed $tipo
			*	@return retorna Tamanho Y do Item
			*/
            protected function returnPosYItem($id,$tipo)
            {
                if(sizeof($this->_itemPosY) < 1)
                {
                    $this->Load();
                }
                return isset($this->_itemPosY[$tipo][$id]) ? $this->_itemPosY[$tipo][$id] : "";
            }
        }
    }

    if(class_exists('UtItemInfo') === false)
    {
        class UtItemInfo extends ReadFile
        {
            private static $_instance = null;
            private $_type = "";
            private $_id = "";
            private $_item = "";
            protected $_version = 0;
            protected $_db = "Muonline";
            private $_skill = "";
            private $_level = 0;
            private $_durability = 0;
            private $_luck = "";
            private $_serial = "";
            private $_harmony = "";
            private $_socket = "";
            private $_socketSlot = 0;
            private $_socketNome = "";
            private $_option = "";
            private $_messageFileInfo = array();
            private $_file = "";
            private $_ancient = "";
            private $_refine = "";
            private $_exe = 0;
            private $_exenome = "";
            private $_position = 0;
            private $_harmonyName = "";

            public function setDatabase($db)
            {
                $this->_db = $db;
                return $this;
            }

            private function getDatabase()
            {
                return $this->_db;
            }

            protected function getVersion()
            {
                return $this->_version;
            }

            public function setVersion($ver)
            {
                if(empty($ver))
                {
                    throw new Exception('Version of the game cannot be Empty');
                }

                $this->_version = $ver;

                return $this;
            }

            protected function getType($hex)
            {
                $this->_item = $hex;
                if($this->_version == 2)
                {
                    $this->_type = hexdec(substr($this->_item, 18,1));
                    return $this->_type;
                }
                $this->_type = ((hexdec(substr($this->_item, 0, 2)) & 0xE0) >> 5) + (((hexdec(substr($this->_item, 14,2)) & 0x80) == 0x80) ? 8 : 0);
                return $this->_type;
            }

            protected function getId($hex)
            {
                $this->_item = $hex; 

                if($this->_version == 2)
                {  
                    $this->_id = ((hexdec(substr($this->_item, 0, 2)) & 0xFF));
                    return $this->_id;
                }
                $this->_id = ((hexdec(substr($this->_item, 0, 2)) & 0x1F));
                return $this->_id;
            }

            protected function getSkill($hex)
            {
                $this->_item = $hex; 
                $this->_skill = ((hexdec(substr($this->_item, 2, 2)) & 0x80) == 0x80) ? " + Skill" : "";
                return $this->_skill;
            }

            protected function getLevel($hex)
            {
                $this->_item = $hex;   
                $this->_level = (hexdec(substr($this->_item, 2, 2)) & 0x78) >> 3;
                if ($this->_level == 0)
                {
                } 
                else 
                {
                    return " + " . $this->_level;
                }
            }

            public function setFile($file)
            {
                if(empty($file))
                {
                    throw new Exception('File with Information the Message cannot be Empty');
                }

                $this->_file = $file;
                return $this;  
            }

            protected function checkFileEmpty()
            {
                if(emptY($this->_file))
                {
                    throw new Exception('File with Information the Message cannot be Empty');
                }
            }

            protected function getLuck($hex)
            {
                $this->_item = $hex; 
                $this->_luck = (hexdec(substr($this->_item, 2, 2)) & 0x04);
                if($this->_luck === 0x04)
                {
                    $this->checkFileEmpty();
                    $Luck = $this->getMessageFile(); 
                    $this->_luck = $Luck['Luck']['LUCK_MSG_1'];
                    $this->_luck .= "<br />";
                    $this->_luck .= $Luck['Luck']['LUCK_MSG_2'];
                }  
                return $this->_luck;
            }

            protected function getDurability($hex)
            {
                $this->_item = $hex; 
                $this->_durability = hexdec(substr($this->_item, 4, 2));
                return $this->_durability;
            }

            protected function getMessageFile()
            {
                return $this->_messageFileInfo = parse_ini_file($this->_file);
            }

            protected function getOption($hex)
            {
                $this->_item = $hex;
                $this->_option = (((hexdec(substr($this->_item, 2, 2)) & 0x03)) + (((hexdec(substr($this->_item, 14, 2)) & 0x40) == 0x40) ? 4 : 0)) * 4;
                if ($this->_option == 0) 
                {

                } 
                else 
                {
                    $this->checkFileEmpty();
                    $File = $this->getMessageFile();
                    return $File['Defence']['DEFENCE_MSG'].' + ' . $this->_option;
                }
            }

            protected function getAncient($hex)
            {
                $this->_item = $hex;
                $this->checkFileEmpty();
                $Anc = $this->getMessageFile();
                $this->_ancient = (($this->_item & 0x00) == 0x00) ?  "" : "" ;
                $this->_ancient = (($this->_item & 0x05) == 0x05) ?  $Anc['Ancient']['ANCIENT_MSG_1'] : "" ;
                $this->_ancient = (($this->_item & 0x09) == 0x09) ?  $Anc['Ancient']['ANCIENT_MSG_2'] : "" ;
                return $this->_ancient;
            }   

            protected function getExe($hex)
            {
                $this->_item = $hex;
                $this->_exe = 0;
                $Execelente = hexdec(substr($this->_item, 14, 2));

                ($Execelente & 0x01) == 0x01 ? $this->_exe = $this->_exe + 1  : $this->_exe = $this->_exe;
                ($Execelente & 0x02) == 0x02 ? $this->_exe = $this->_exe + 1  : $this->_exe = $this->_exe;
                ($Execelente & 0x04) == 0x04 ? $this->_exe = $this->_exe + 1  : $this->_exe = $this->_exe;
                ($Execelente & 0x08) == 0x08 ? $this->_exe = $this->_exe + 1  : $this->_exe = $this->_exe;
                ($Execelente & 0x10) == 0x10 ? $this->_exe = $this->_exe + 1  : $this->_exe = $this->_exe;
                ($Execelente & 0x20) == 0x20 ? $this->_exe = $this->_exe + 1  : $this->_exe = $this->_exe;
                switch($this->_exe)
                {
                    case 0:
                        return "";
                        break;
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                        return $this->_exe;
                        break;    
                }

            }

            protected function getExeName($hex)
            {
                $this->_item = $hex;
                $this->_type = $this->getType($hex);
                $name = "";
                $this->_exenome = hexdec(substr($this->_item, 14, 2));

                if($this->_type > 5 && $this->_type < 12 || $this->_type == 13)
                {
                    $this->checkFileEmpty();
                    $EXC = $this->getMessageFile();
                    ($this->_exenome & 0x01) == 0x01 ? $name = "\t ".$EXC['Excelente']['EXCELENTE_MSG_1']." </br>" :"";
                    ($this->_exenome & 0x02) == 0x02 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_2']."</br>" :"";
                    ($this->_exenome & 0x04) == 0x04 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_3']."</br>" :"";
                    ($this->_exenome & 0x08) == 0x08 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_4']."</br>" :"";
                    ($this->_exenome & 0x10) == 0x10 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_5']."</br>" :"";
                    ($this->_exenome & 0x20) == 0x20 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_6']."</br>" :"";
                    return $name;
                    unset($name);
                }

                elseif($this->_type >= 0 && $this->_type <= 4 )
                {
                    $this->checkFileEmpty();
                    $EXC = $this->getMessageFile();
                    ($this->_exenome & 0x01) == 0x01 ? $name = "\t ".$EXC['Excelente']['EXCELENTE_MSG_7']." </br>" :"";
                    ($this->_exenome & 0x02) == 0x02 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_8']."</br>" :"";
                    ($this->_exenome & 0x04) == 0x04 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_9']."</br>" :"";
                    ($this->_exenome & 0x08) == 0x08 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_10']."</br>" :"";
                    ($this->_exenome & 0x10) == 0x10 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_11']."</br>" :"";
                    ($this->_exenome & 0x20) == 0x20 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_12']."</br>" :"";
                    return $name;
                    unset($name);
                }

                elseif($this->_type == 5 )
                {

                } 

                elseif($this->_type == 12 )
                {
                    $this->checkFileEmpty();
                    $EXC = $this->getMessageFile();
                    ($this->_exenome & 0x01) == 0x01 ? $name = "\t ".$EXC['Excelente']['EXCELENTE_MSG_13']." </br>" :"";
                    ($this->_exenome & 0x02) == 0x02 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_14']."</br>" :"";
                    ($this->_exenome & 0x04) == 0x04 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_15']."</br>" :"";
                    ($this->_exenome & 0x08) == 0x08 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_16']."</br>" :"";
                    ($this->_exenome & 0x10) == 0x10 ? $name .= "\t ".$EXC['Excelente']['EXCELENTE_MSG_17']."</br>" :"";
                    ($this->_exenome & 0x20) == 0x20 ? $name .= "" :"";
                    return $name;
                    unset($name);
                }      
            }

            protected function getSerial($hex)
            {
                $this->_item = $hex; 
                $this->_durability = hexdec(substr($this->_item, 6, 8));
                return $this->_durability;
            }

            protected function getRefine($hex)
            {
                $this->_item = $hex;
                $this->_refine = (hexdec(substr($this->_item,19,1)) & 0x08);

                if($this->_refine === 0x08)
                {
                    $this->checkFileEmpty();
                    $Refine = $this->getMessageFile();
                    $this->_refine = $Refine['Refine']['REFINE_MSG_1'];  
                    $this->_refine .= "<br />";
                    $this->_refine .= $Refine['Refine']['REFINE_MSG_2'];
                }

                return $this->_refine;
            }

            protected function alterSerial($item2)
            {
                $a = mssql_fetch_row(mssql_query("exec ".$this->_db.".dbo.WZ_GetItemSerial"));
                $serial = str_pad(dechex($a[0]), 8, "0", STR_PAD_LEFT);
                $item = substr_replace($item2,$serial,6,8);
                return $item;
            }

            protected function getHarmony($hex)
            {
                $this->_item = $hex;
                $this->_harmony =  ((substr($this->_item,20,1)));
                $this->_harmony .= ((substr($this->_item,21,1)));

                return $this->_harmony;
            }

            protected function getSocket($hex,$slot)
            {
                $this->_item = $hex;
                switch($slot)
                {
                    case 1: $this->_socketSlot = 22; break;
                    case 2: $this->_socketSlot = 24; break;
                    case 3: $this->_socketSlot = 26; break;
                    case 4: $this->_socketSlot = 27; break;
                    case 5: $this->_socketSlot = 30; break;

                }  

                $this->_socket = hexdec(substr($this->_item,$this->_socketSlot,2));
                return $this->_socket;    
            } 

            public function returnItemBySerial($serial)
            {
                $serial = "0x" . str_pad(dechex($serial),8,"0",STR_PAD_LEFT);

                $a = mssql_fetch_row(mssql_query("select Name,AccountID from ".$this->_db.".dbo.character where ( CHARINDEX (" . $serial . ", inventory ) %10 = 4)"));
                $b = mssql_fetch_row(mssql_query("select AccountID from ".$this->_db.".dbo.warehouse where ( CHARINDEX (" . $serial . ", items ) %10 = 4)"));

                if ($b[0] != "" || $a[0] != "")
                {
                    $result = "Account: " . $b[0];
                    $result .= "\t\tCharacter: " . $a[0];
                }
                else
                {
                    $result = "Item com o Serial ".$serial." Inexistente";
                }

                return $result;
            }      

            protected function getItemPosition($pos)
            {
                $this->_position = $pos;
                $this->checkFileEmpty();
                $PosIt = $this->getMessageFile();

                switch($this->_position)
                {
                    case 0: return  $PosIt['Position']['POSITION_MSG_1']; break;
                    case 1: return  $PosIt['Position']['POSITION_MSG_2']; break;
                    case 2: return  $PosIt['Position']['POSITION_MSG_3']; break;
                    case 3: return  $PosIt['Position']['POSITION_MSG_4']; break;
                    case 4: return  $PosIt['Position']['POSITION_MSG_5']; break;
                    case 5: return  $PosIt['Position']['POSITION_MSG_6']; break;
                    case 6: return  $PosIt['Position']['POSITION_MSG_7']; break;
                    case 7: return  $PosIt['Position']['POSITION_MSG_8']; break;
                    case 8: return  $PosIt['Position']['POSITION_MSG_9']; break;
                    case 9: return  $PosIt['Position']['POSITION_MSG_10']; break;                                      
                    case 10: return  $PosIt['Position']['POSITION_MSG_11']; break;
                    case 11: return  $PosIt['Position']['POSITION_MSG_12']; break;   
                    default: return  $PosIt['Position']['POSITION_MSG_13']; break;
                } 
            } 

            protected function getItemName($tipo, $id)
            {
                return parent::ReturnItemName($id,$tipo);
            }  

            protected function getItemPosX($id,$tipo)
            {
                return parent::ReturnPosXItem($id,$tipo);
            }

            protected function getItemPosY($id,$tipo)
            {
                return parent::ReturnPosYItem($id,$tipo);
            }   

            public function deleteItemByHex($type,$id,$account = null)
            {
                $this->getWarehouseSize();
                ($this->_version == 2) ? $cortar = 32 : $cortar = 20;
                $tamanho = str_repeat("F",$cortar);
                if($account === null)
                {
                    $conta = mssql_query("SELECT memb___id from ".$this->_db.".dbo.Memb_info");    
                }
                else
                {
                    $conta = mssql_query("SELECT memb___id from ".$this->_db.".dbo.Memb_info where memb___id='".$account."'");
                }

                $num = mssql_num_rows($conta);
                for($x = 0; $x < $num ; $x++)
                {
                    $fetch = mssql_fetch_row($conta);
                    $query = mssql_query("SELECT CONVERT(TEXT, CONVERT(VARCHAR(".$this->_WarehouseSize."), Items)) AS 'Warehouse' FROM ".$this->_db.".dbo.warehouse WHERE AccountID = '" . $fetch[0] . "'");
                    if ($query) 
                    {
                        if ($character = mssql_fetch_object($query)) 
                        {
                            $character->Warehouse = strtoupper(bin2hex($character->Warehouse));
                            $items = str_split($character->Warehouse, $cortar);
                            (int)$coint=0;
                            foreach ($items as $id => $item) 
                            {
                                if($items[$id] == $tamanho)
                                {

                                }
                                else 
                                {   
                                    if($this->tipo($items[$id]) == $type && $this->id($items[$id]) == $id) 
                                    { 
                                        $items[$id] = $tamanho;
                                        $coint++;
                                    } 
                                }   
                            }
                            mssql_query("UPDATE ".$this->_db.".dbo.warehouse SET Items = 0x" . implode('', $items) . " where AccountID='".$fetch[0]."'");
                        } 
                    }
                }

            }

            protected function getSocketName($nome,$num = 0)
            {
                $this->num = $num;
                $this->checkFileEmpty();
                $Socket = $this->getMessageFile();
                switch($nome)
                { 
                    default: $this->_socketNome = "Socket ".$this->num . ": " . $Socket['Socket']['SOCKET_MSG_1'];
                        break;  
                    case 255: $this->_socketNome = "Socket ".$this->num . ": " . $Socket['Socket']['SOCKET_MSG_2'];
                        break;
                    case 0: $this->_socketNome = "";
                        break;
                    case 1: $this->_socketNome = "Socket ".$this->num . ": " . $Socket['Socket']['SOCKET_MSG_3'] . " + 20" ;
                        break;
                    case 201:
                    case 51: 
                    case 101:
                    case 151: 
                        $this->_socketNome = "Socket ".$this->num . ": " . $Socket['Socket']['SOCKET_MSG_3'] . " + 400";
                        break;
                    case 2: $this->_socketNome = "Socket ".$this->num . ": " . $Socket['Socket']['SOCKET_MSG_4'] . " + 7";
                        break;
                    case 52:
                    case 102:
                    case 152:
                    case 202:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_4'] . " + 1";
                        break;
                    case 3: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_5'] . " + 30";
                        break;
                    case 53:
                    case 103:
                    case 153:
                    case 203:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_5'] . " + 1" ;
                        break;
                    case 4: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_5'] . " + 20" ;
                        break;
                    case 54:
                    case 104:
                    case 154:
                    case 204:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_6'] ;
                        break;
                    case 5: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_7'] . " + 20" ;
                        break;
                    case 55:
                    case 105:
                    case 155:
                    case 205:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_7'] . " + 1" ;
                        break;
                    case 6: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_8'] . " + 40" ;
                        break;
                    case 56:
                    case 106:
                    case 156:
                    case 206:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_8'] . " + 1" ;
                        break;
                    case 11: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_9'] . " + 10";
                        break;
                    case 61:
                    case 111:
                    case 161:
                    case 211:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_9'] . " + 1" ;
                        break;
                    case 12: $this->_socketNome = "Socket ".$this->num." :" . $Socket['Socket']['SOCKET_MSG_10'] . " + 30";
                        break;
                    case 62:
                    case 112:
                    case 162:
                    case 212:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_10'] . " + 1" ;
                        break;
                    case 13: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_11'] . " + 7" ;
                        break;
                    case 63:
                    case 113:
                    case 163:
                    case 213:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_11'] . " + 1" ;
                        break;
                    case 14: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_12'] . " + 4" ;
                        break;
                    case 64:
                    case 114:
                    case 164:
                    case 214:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_12'] . " + 1" ;
                        break;
                    case 15: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_13'] . " + 5" ;
                        break;
                    case 65:
                    case 115:
                    case 165:
                    case 215:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_13'] . " + 1" ;
                        break;
                    case 17: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_14'] . " + 8" ;
                        break;
                    case 67: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_14'] . " + 49" ;
                        break;
                    case 117: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_14'] . " + 50" ;
                        break;
                    case 167: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_14'] . " + 51" ;
                        break;
                    case 217: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_14'] . " + 52" ;
                        break;                
                    case 18: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_15'] . " + 8" ;
                        break;
                    case 68: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_15'] . " + 49" ;
                        break;
                    case 117: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_15'] . " + 50" ;
                        break;
                    case 167: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_15'] . " + 51" ;
                        break;
                    case 217: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_15'] . " + 52" ;
                        break;
                    case 19: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_16'] . " + 37" ;
                        break;
                    case 69:
                    case 119:
                    case 169:
                    case 219:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_16'] . " + 1" ;
                        break;
                    case 20: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_17'] . " + 25" ;
                        break;
                    case 70:
                    case 120:
                    case 170:
                    case 220:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_17'] . " + 1" ;
                        break;
                    case 21: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_18'] . " + 30" ;
                        break;
                    case 71:
                    case 121:
                    case 171:
                    case 221:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_18'] . " + 1" ;
                        break;
                    case 22: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_19'] . " + 8" ;
                        break;
                    case 72:
                    case 122:
                    case 172:
                    case 222:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_19'] . " + 1" ;
                        break;
                    case 23: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_20'] . " + 4" ;
                        break;
                    case 73:
                    case 123:
                    case 173:
                    case 223:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_20'] . " + 1" ;
                        break;
                    case 24: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_21'] . " + 4" ;
                        break;
                    case 74:
                    case 124:
                    case 174:
                    case 224:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_21'] . " + 1" ;
                        break;
                    case 25: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_22'] . " + 7" ;
                        break;
                    case 75:
                    case 125:
                    case 175:
                    case 225:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_22'] . " + 1" ;
                        break;
                    case 26: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_23'] . " + 25" ;
                        break;
                    case 76:
                    case 126:
                    case 176:
                    case 226:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_23'] . " + 1" ;
                        break;                    
                    case 27: $this->_socketNome = "Socket ".$this->num." :" . $Socket['Socket']['SOCKET_MSG_24'] . " + 3";
                        break;
                    case 77:
                    case 127:
                    case 177:
                    case 227:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_24'] . " + 1" ;
                        break;    
                    case 30: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_25'] . " + 15" ;
                        break;
                    case 80:
                    case 130:
                    case 180:
                    case 230:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_25'] . " + 1" ;
                        break;             
                    case 31: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_26'] . " + 10" ;
                        break;
                    case 81:
                    case 131:
                    case 181:
                    case 231:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_26'] . " + 1" ;
                        break;         
                    case 32: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_27'] . " + 30" ;
                        break;
                    case 82:
                    case 132:
                    case 182:
                    case 232:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_27'] . " + 1" ;
                        break;  
                    case 33: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_28'] . " + 20" ;
                        break;
                    case 83:
                    case 133:
                    case 183:
                    case 233:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_28'] . " + 20" ;
                        break;
                    case 37: $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_29'] . " + 30" ;
                        break;
                    case 87:
                    case 137:
                    case 187:
                    case 237:
                        $this->_socketNome = "Socket ".$this->num." : " . $Socket['Socket']['SOCKET_MSG_29'] . " + 1" ;
                        break;

                }
                unset($nome,$this->num);
                return $this->_socketNome;    
            }     

            protected function getHarmonyName($item,$tipo)
            {
                $this->checkFileEmpty();
                $Harmo = $this->getMessageFile();

                if($tipo >= 0 && $tipo <= 4 )
                {
                    switch($item)
                    {
                        default:$this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_1'];
                            break;
                        case 00: $this->_harmonyName = "";
                            break;
                        case 10: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 2";
                            break;    
                        case 11: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 3";
                            break; 
                        case 12: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 4";
                            break;
                        case 13: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 5";
                            break;
                        case 14: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 6";
                            break;
                        case 15: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 7";
                            break;
                        case 16: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 9";
                            break;
                        case 17: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 11";
                            break;
                        case 18: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 12";
                            break;
                        case 19: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 14";
                            break; 
                        case "1A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 15";
                            break; 
                        case "1B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 16";
                            break;
                        case "1C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 17";
                            break;
                        case "1D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 20";
                            break; 
                        case "1E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 100000";
                            break; 
                        case "1F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_2'] . " + 110000";
                            break; 
                        case 20: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 3";
                            break;    
                        case 21: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 4";
                            break; 
                        case 22: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 5";
                            break;
                        case 23: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 6";
                            break;
                        case 24: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 7";
                            break;
                        case 25: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 8";
                            break;
                        case 26: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 10";
                            break;
                        case 27: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 12";
                            break;
                        case 28: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 14";
                            break;
                        case 29: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 17";
                            break; 
                        case "2A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 20";
                            break; 
                        case "2B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 23";
                            break;
                        case "2C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 26";
                            break;
                        case "2D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 29";
                            break; 
                        case "2E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 100000";
                            break; 
                        case "2F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_3'] . " + 110000";
                            break;
                        case 30: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 6";
                            break;    
                        case 31: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 8";
                            break; 
                        case 32: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 10";
                            break;
                        case 33: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 12";
                            break;
                        case 34: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 14";
                            break;
                        case 35: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 16";
                            break;
                        case 36: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 20";
                            break;
                        case 37: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 23";
                            break;
                        case 38: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 26";
                            break;
                        case 39: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 29";
                            break; 
                        case "3A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 32";
                            break; 
                        case "3B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 35";
                            break;
                        case "3C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 37";
                            break;
                        case "3D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 40";
                            break; 
                        case "3E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 100000";
                            break; 
                        case "3F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 110000";
                            break; 
                        case 40: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 6";
                            break;    
                        case 41: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 8";
                            break; 
                        case 42: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 10";
                            break;
                        case 43: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 12";
                            break;
                        case 44: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 14";
                            break;
                        case 45: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 16";
                            break;
                        case 46: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 20";
                            break;
                        case 47: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 23";
                            break;
                        case 48: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 26";
                            break;
                        case 49: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 29";
                            break; 
                        case "4A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 32";
                            break; 
                        case "4B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 35";
                            break;
                        case "4C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 37";
                            break;
                        case "4D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 40";
                            break; 
                        case "4E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 100000";
                            break; 
                        case "4F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 110000";
                            break;                    
                        case 50: 
                        case 51:
                        case 52:
                        case 53:
                        case 54:
                        case 55:
                        case "5E":
                        case "5F":
                            $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 0";
                            break;    
                        case 56: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 7";
                            break;
                        case 57: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 8";
                            break;
                        case 58: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 9";
                            break;
                        case 59: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 11";
                            break; 
                        case "5A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 12";
                            break; 
                        case "5B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 14";
                            break;
                        case "5C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 16";
                            break;
                        case "5D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_6'] . " + 19";
                            break; 
                        case 60: 
                        case 61:
                        case 62:
                        case 63:
                        case 64:
                        case 65:
                        case "6E":
                        case "6F":
                            $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 0";
                            break;    
                        case 66: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 12";
                            break;
                        case 67: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 14";
                            break;
                        case 68: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 16";
                            break;
                        case 69: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 18";
                            break; 
                        case "6A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 20";
                            break; 
                        case "6B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 22";
                            break;
                        case "6C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 24";
                            break;
                        case "6D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 30";
                            break; 
                        case 70:
                        case 71:
                        case 72:
                        case 73:
                        case 74:
                        case 75:
                        case 76:
                        case 77:
                        case 78:
                        case "7E":  
                        case "7F":
                            $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 0";
                            break;    
                        case 79: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 12";
                            break; 
                        case "7A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 14";
                            break; 
                        case "7B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 16";
                            break;
                        case "7C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 18";
                            break;
                        case "7D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 22";
                            break; 
                        case 80: 
                        case 81: 
                        case 82:
                        case 83:
                        case 84:
                        case 85:
                        case 86:
                        case 87:
                        case 88:
                        case "8E":
                        case "8F":
                            $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_9'] . " + 0";
                            break;  
                        case 89: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_9'] . " + 5";
                            break; 
                        case "8A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_9'] . " + 7";
                            break; 
                        case "8B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_9'] . " + 9";
                            break;
                        case "8C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_9'] . " + 11";
                            break;
                        case "8D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_9'] . " + 14";
                            break; 
                        case 90:
                        case 91: 
                        case 92:
                        case 93:
                        case 94:
                        case 95:
                        case 96:
                        case 97:
                        case 98:
                        case "9E":
                        case "9F":
                            $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 0";
                            break;    
                        case 99: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 3";
                            break; 
                        case "9A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 5";
                            break; 
                        case "9B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 7";
                            break;
                        case "9C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 9";
                            break;
                        case "9D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 10";
                            break; 
                        case "A0": 
                        case "A1": 
                        case "A2": 
                        case "A3": 
                        case "A4": 
                        case "A5": 
                        case "A6": 
                        case "A7": 
                        case "A8": 
                        case "A9": 
                        case "AA": 
                        case "AB": 
                        case "AC": 
                        case "AE": 
                        case "AF": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_11'] . " + 0";
                            break;
                        case "AD": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_11'] . " + 10";
                            break;
                    }
                }
                if($tipo == 5)
                {
                    switch($item)
                    {
                        default:$this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_1'];
                            break;
                        case 00: $this->_harmonyName = "";
                            break;
                        case 10: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 6";
                            break;    
                        case 11: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 8";
                            break; 
                        case 12: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 10";
                            break;
                        case 13: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 12";
                            break;
                        case 14: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 14";
                            break;
                        case 15: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 16";
                            break;
                        case 16: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 17";
                            break;
                        case 17: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 18";
                            break;
                        case 18: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 19";
                            break;
                        case 19: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 21";
                            break; 
                        case "1A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 23";
                            break; 
                        case "1B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 25";
                            break;
                        case "1C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 27";
                            break;
                        case "1D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 31";
                            break; 
                        case "1E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 100000";
                            break; 
                        case "1F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_12'] . " + 110000";
                            break; 
                        case 20: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 6";
                            break;    
                        case 21: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 8";
                            break; 
                        case 22: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 10";
                            break;
                        case 23: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 12";
                            break;
                        case 24: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 14";
                            break;
                        case 25: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 16";
                            break;
                        case 26: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 20";
                            break;
                        case 27: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 23";
                            break;
                        case 28: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 26";
                            break;
                        case 29: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 29";
                            break; 
                        case "2A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 32";
                            break; 
                        case "2B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 35";
                            break;
                        case "2C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 37";
                            break;
                        case "2D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 40";
                            break; 
                        case "2E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 100000";
                            break; 
                        case "2F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_4'] . " - 110000";
                            break; 
                        case 30: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 6";
                            break;    
                        case 31: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 8";
                            break; 
                        case 32: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 10";
                            break;
                        case 33: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 12";
                            break;
                        case 34: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 14";
                            break;
                        case 35: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 16";
                            break;
                        case 36: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 20";
                            break;
                        case 37: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 23";
                            break;
                        case 38: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 26";
                            break;
                        case 39: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 29";
                            break; 
                        case "3A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 32";
                            break; 
                        case "3B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 35";
                            break;
                        case "3C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 37";
                            break;
                        case "3D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 40";
                            break; 
                        case "3E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 100000";
                            break; 
                        case "3F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_5'] . " - 110000";
                            break;                    
                        case 40:  
                        case 41:  
                        case 42: 
                        case 43: 
                        case 44: 
                        case "4E":
                        case "4F":
                        case 45: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 0";
                            break;
                        case 46: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 7";
                            break;
                        case 47: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 10";
                            break;
                        case 48: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 13";
                            break;
                        case 49: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 16";
                            break; 
                        case "4A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 19";
                            break; 
                        case "4B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 22";
                            break;
                        case "4C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 25";
                            break;
                        case "4D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_8'] . " + 30";
                            break; 
                        case 50:     
                        case 51:  
                        case 52: 
                        case 53: 
                        case 54: 
                        case "5E":
                        case "5F":
                        case 55: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 0";
                            break;
                        case 56: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 10";
                            break;
                        case 57: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 12";
                            break;
                        case 58: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 14";
                            break;
                        case 59: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 16";
                            break; 
                        case "5A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 18";
                            break; 
                        case "5B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 20";
                            break;
                        case "5C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 22";
                            break;
                        case "5D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_7'] . " + 28";
                            break; 
                        case 60:   
                        case 61:  
                        case 62: 
                        case 63: 
                        case 64: 
                        case 65: 
                        case 66:
                        case 67:
                        case "6E":
                        case "6F":
                        case 68: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 0";
                            break;
                        case 69: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 4";
                            break; 
                        case "6A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 6";
                            break; 
                        case "6B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 8";
                            break;
                        case "6C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 10";
                            break;
                        case "6D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_10'] . " + 13";
                            break; 
                        case 70:     
                        case 71:  
                        case 72: 
                        case 73:
                        case 74: 
                        case 75:
                        case 76:
                        case 77: 
                        case 78: 
                        case 79:  
                        case "7A":
                        case "7B":
                        case "7C": 
                        case "7D": 
                        case "7E": 
                        case "7F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_9'] . " + 0";
                            break;                    
                        case "80": 
                        case "81":
                        case "82": 
                        case "83": 
                        case "84": 
                        case "85": 
                        case "86": 
                        case "87": 
                        case "88": 
                        case "89": 
                        case "8A": 
                        case "8B":
                        case "8C": 
                        case "8E":
                        case "8F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_11'] . " + 0";
                            break;
                        case "8D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_11'] . " + 10";
                            break; 

                    }
                }   
                if($tipo > 5 && $tipo <12)    
                {
                    switch($item)
                    {
                        default:$this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_1'];
                            break;
                        case 00: $this->_harmonyName = "";
                            break;
                        case 10: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 3";
                            break;    
                        case 11: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 4";
                            break; 
                        case 12: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 5";
                            break;
                        case 13: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 6";
                            break;
                        case 14: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 7";
                            break;
                        case 15: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 8";
                            break;
                        case 16: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 10";
                            break;
                        case 17: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 12";
                            break;
                        case 18: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 14";
                            break;
                        case 19: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 16";
                            break; 
                        case "1A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 18";
                            break; 
                        case "1B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 20";
                            break;
                        case "1C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 22";
                            break;
                        case "1D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 25";
                            break; 
                        case "1E": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 100000";
                            break; 
                        case "1F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_13'] . " + 110000";
                            break; 
                        case 20:     
                        case 21: 
                        case "2E":
                        case "2F": 
                        case 22: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 0";
                            break;
                        case 23: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 4";
                            break;
                        case 24: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 6";
                            break;
                        case 25: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 8";
                            break;
                        case 26: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 10";
                            break;
                        case 27: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 12";
                            break;
                        case 28: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 14";
                            break;
                        case 29: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 16";
                            break; 
                        case "2A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 18";
                            break; 
                        case "2B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 20";
                            break;
                        case "2C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 22";
                            break;
                        case "2D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_14'] . " + 25";
                            break; 
                        case 30:     
                        case 31: 
                        case "3E": 
                        case "3F":
                        case 32: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 0";
                            break;
                        case 33: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 7";
                            break;
                        case 34: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 9";
                            break;
                        case 35: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 11";
                            break;
                        case 36: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 13";
                            break;
                        case 37: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 15";
                            break;
                        case 38: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 17";
                            break;
                        case 39: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 19";
                            break; 
                        case "3A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 21";
                            break; 
                        case "3B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 23";
                            break;
                        case "3C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 25";
                            break;
                        case "3D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_15'] . " + 30";
                            break; 
                        case 40:     
                        case 41: 
                        case 42: 
                        case 43:
                        case 44: 
                        case "4E":
                        case "4F":
                        case 45: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 0";
                            break;
                        case 46: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 1";
                            break;
                        case 47: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 2";
                            break;
                        case 48: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 3";
                            break;
                        case 49: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 4";
                            break; 
                        case "4A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 5";
                            break; 
                        case "4B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 6";
                            break;
                        case "4C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 7";
                            break;
                        case "4D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_16'] . " + 8";
                            break; 
                        case 50:     
                        case 51: 
                        case 52: 
                        case 53: 
                        case 54:
                        case 55: 
                        case 56: 
                        case 57: 
                        case "5E":
                        case "5F":
                        case 58: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_17'] . " + 0";
                            break;
                        case 59: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_17'] . " + 1";
                            break; 
                        case "5A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_17'] . " + 2";
                            break; 
                        case "5B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_17'] . " + 3";
                            break;
                        case "5C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_17'] . " + 4";
                            break;
                        case "5D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_17'] . " + 5";
                            break;                      
                        case 60:  
                        case 61:  
                        case 62: 
                        case 63:
                        case 64:
                        case 65:
                        case 66: 
                        case 67: 
                        case "6E":
                        case "6F":
                        case 68: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_18'] . " + 0";
                            break;
                        case 69: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_18'] . " + 3";
                            break; 
                        case "6A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_18'] . " + 4";
                            break; 
                        case "6B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_18'] . " + 5";
                            break;
                        case "6C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_18'] . " + 6";
                            break;
                        case "6D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_18'] . " + 8";
                            break; 
                        case 70:     
                        case 71:  
                        case 72:
                        case 73: 
                        case 74:
                        case 75: 
                        case 76: 
                        case 77: 
                        case "7E":
                        case "7F":
                        case 78: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_19'] . " + 0";
                            break;
                        case 79: $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_19'] . " + 3";
                            break; 
                        case "7A": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_19'] . " + 4";
                            break; 
                        case "7B": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_19'] . " + 5";
                            break;
                        case "7C": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_19'] . " + 6";
                            break;
                        case "7D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_19'] . " + 7";
                            break;                     
                        case "80": 
                        case "81": 
                        case "82": 
                        case "83": 
                        case "84": 
                        case "85":
                        case "86": 
                        case "87": 
                        case "88": 
                        case "89": 
                        case "8A":
                        case "8B": 
                        case "8C": 
                        case "8E": 
                        case "8F": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_20'] . " + 0";
                            break;
                        case "8D": $this->_harmonyName = $Harmo['Harmony']['HARMONY_MSG_20'] . " + 5";
                            break; 

                    }    
                }

                unset($tipo,$item);
                return $this->_harmonyName; 
            }       

            protected function __construct()
            {
            }

            protected function ClearVariable()
            {
                $this->_type = "";
                $this->_id = "";
                $this->_item = "";
                $this->_version = "";
                $this->_skill = "";
                $this->_level = 0;
                $this->_durability = 0;
                $this->_luck = "";
                $this->_serial = "";
                $this->_harmony = "";
                $this->_socket = "";
                $this->_socketSlot = 0;
                $this->_socketNome = "";
                $this->_option = "";
                $this->_messageFileInfo = array();
                $this->_file = "";
                $this->_ancient = "";
                $this->_refine = "";
                $this->_exe = 0;
                $this->_exenome = "";
                $this->_position = 0;
                $this->_harmonyName = "";
            }

            protected function __destroy()
            {
                $this->ClearVariable();
            }

            public static function getStance()
            {
                if(self::$_instance === null)
                    self::$_instance = new self;

                return self::$_instance;
            }

            public function CreateHexItem($tipo,$id,$lvl = 0,$opt = 0,$exe = array(),$skill = false,$luck = false ,$dura = 0 ,$anc = 0,$lvl_380 = false,$harm = array(),$sock = array(),$versao)
            {
                return UtCreateItem::getStance()->returnHexItem($tipo, $id, $lvl, $opt, $exe, $skill, $luck, $dura ,$anc ,$lvl_380, $harm, $sock,$versao);
            }

        }
    }

    if(class_exists('UtItemParse') === false)
    {
        final class UtItemParse extends UtItemInfo
        {
            private static $_instance = null;
            public $_type = "";
            private $_hexa = "";
            public $_id = "";
            public $_skill = "";
            public $_level = 0;
            public $_durability = 0;
            public $_luck = "";
            public $_serial = "";
            public $_harmony = "";
            public $_socket = "";
            public $_option = "";
            public $_ancient = "";
            public $_refine = "";
            public $_exe = 0;
            public $_name = "";
            public $_class = array();

            public static function getStance()
            {
                if(self::$_instance === null)
                    self::$_instance = new self;

                return self::$_instance;
            }

            protected function __construct()
            {
                $this->ClearAll(); 
            }

            public function ClearAll()
            {
                $this->_hexa = "";
                $this->_type = "";
                $this->_id = "";
                $this->_skill = "";
                $this->_level = "";
                $this->_durability = "";
                $this->_luck = "";
                $this->_serial = "";
                $this->_socket = "";
                $this->_harmony = "";
                $this->_option = "";
                $this->_ancient = "";
                $this->_refine = "";
                $this->_exe = "";
                $this->_name = "";
            }

            public function getNameInfo($id,$tipo)
            {
                return parent::getItemName($tipo,$id);
            }

            public function getItemClass($id,$tipo)
            {
                return parent::ReturnItemClass($id,$tipo);
            }

            public function SerialTake($hexa)
            {
                return parent::getSerial($hexa);
            }

            public function Parse($item)
            {
                $this->_hexa = $item;
                $this->_type = parent::getType($this->_hexa);
                $this->_id = parent::getId($this->_hexa);
                $this->_exe = parent::getExe($this->_hexa);
                $this->_name = parent::getItemName($this->_type,$this->_id);
                $this->_serial = parent::getSerial($this->_hexa);
                $this->_skill = parent::getSkill($this->_hexa);
                $this->_level = parent::getLevel($this->_hexa);
                $this->_durability = parent::getDurability($this->_hexa);
                $this->_luck = parent::getLuck($this->_hexa);
                $this->_serial = parent::getSerial($this->_hexa);
                $this->_socket = parent::getSocket($this->_hexa,$lit);
                $this->_harmony = parent::getHarmony($this->_hexa);
                $this->_option = parent::getOption($this->_hexa);
                $this->_ancient = parent::getAncient($this->_hexa);
                $this->_refine = parent::getRefine($this->_hexa);
            }
        }
    }
?>
